package leetcode_day._2022._202208._1120;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 1656. 设计有序流
 * 算法：模拟
 *
 * @author yzh
 * @version 1.0
 * @date 2022/8/16 21:47
 */
public class _16 {

    class OrderedStream {
        String[] stream = new String[1010];
        int ptr, n;

        public OrderedStream(int _n) {
            Arrays.fill(stream, "");
            ptr = 1;
            n = _n;
        }

        public List<String> insert(int idKey, String value) {
            stream[idKey] = value;
            List<String> res = new ArrayList<>();
            while (stream[ptr].length() == 5) res.add(stream[ptr++]);
            return res;
        }
    }

}
